# added by yinchao, Thu June 27 16:31	2024

import urllib.request
from bs4 import BeautifulSoup
import ssl

# Ignore ssl certificate errors
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE

url = input('Enter a url address(default https://m.boquge.com/wapbook/90695_155773726.html): ')
if url == '':
    url = 'https://m.boquge.com/wapbook/90695_155773726.html'

html = urllib.request.urlopen(url=url, context=ctx).read()
# 用它替代 regular expression 以分析 html 文档.
soup = BeautifulSoup(html, 'html.parser')

tags = soup('p')
print(f'The count of p tag is {len(tags)}')
